import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop027-新增标签组流程"

str1="华为老大"

# 1.点击“添加标签组”，填写标签组名称“华为老大”，标签排序255。
firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu3(firefox,"商品管理","商品标签","商品标签分组")
firefox.find_element_by_link_text("添加标签组").click()
firefox.find_element_by_id("tag_group_name").send_keys(str1)
# 2.点击“保存保存标签组信息”，保存成功。
firefox.find_element_by_xpath("(//button[contains(.,'保存标签组信息')])[2]").click()
time.sleep(2)
# 断言
try:
    firefox.find_element_by_xpath("//td[text()='%s']"%str1).is_displayed()
    writeLog("%s 测试通过" % testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()